﻿namespace HySoft.Cash.Business
{
    using Huayou.Common.Database;
    using Huayou.Utils;
    using HySoft.Cash.BaseClass;
    using HySoft.Cash.DB;
    using HySoft.Cash.Structure;
    using System;
    using System.Data;
    using System.Web.UI;

    public class TemppaymentBN : BaseBusiness
    {
        private TemppaymentDB db;

        public TemppaymentBN(Page page) : base(page)
        {
            this.db = null;
            this.db = new TemppaymentDB(base.curDBOperater);
        }

        public TemppaymentBN(Page page, DBOperate oper) : base(page, oper)
        {
            this.db = null;
            this.db = new TemppaymentDB(base.curDBOperater);
        }

        public bool Add(TemppaymentDT detail)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Add(detail);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public bool Delete(int Sid)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Delete(Sid);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public void Dispose()
        {
            base.Dispose();
            if (this.db != null)
            {
                this.db = null;
            }
        }

        public bool Edit(TemppaymentDT detail)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Edit(detail);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public TemppaymentDT Get(int Sid)
        {
            TemppaymentDT tdt = null;
            try
            {
                try
                {
                    tdt = this.db.Get(Sid);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return tdt;
        }

        public DataTable GetList()
        {
            base.DBFieldList = "Sid,EmpSid,BankSid,PaymentDate,PaymentAmount,PaymentDD,PaymentMM,PaymentYY,OrgSid";
            base.DBTable = "tEmpPayment";
            return base.CommonGetList();
        }

        public void QueryBankSid(int BankSid)
        {
            base.Filter = "BankSid= " + BankSid;
        }

        public void QueryEmpSid(int EmpSid)
        {
            base.Filter = "EmpSid= " + EmpSid;
        }

        public void QueryOrgSid(int OrgSid)
        {
            base.Filter = "OrgSid= " + OrgSid;
        }

        public void QueryPaymentAmount(decimal PaymentAmount)
        {
            base.Filter = "PaymentAmount= " + PaymentAmount;
        }

        public void QueryPaymentDate(string PaymentDate)
        {
            if ((PaymentDate != null) && (PaymentDate.Trim() != ""))
            {
                base.Filter = "PaymentDate like '%" + StringUtils.ToSQL(PaymentDate) + "%'";
            }
        }

        public void QueryPaymentDD(string PaymentDD)
        {
            if ((PaymentDD != null) && (PaymentDD.Trim() != ""))
            {
                base.Filter = "PaymentDD like '%" + StringUtils.ToSQL(PaymentDD) + "%'";
            }
        }

        public void QueryPaymentMM(string PaymentMM)
        {
            if ((PaymentMM != null) && (PaymentMM.Trim() != ""))
            {
                base.Filter = "PaymentMM like '%" + StringUtils.ToSQL(PaymentMM) + "%'";
            }
        }

        public void QueryPaymentYY(string PaymentYY)
        {
            if ((PaymentYY != null) && (PaymentYY.Trim() != ""))
            {
                base.Filter = "PaymentYY like '%" + StringUtils.ToSQL(PaymentYY) + "%'";
            }
        }

        public void QuerySid(int Sid)
        {
            base.Filter = "Sid= " + Sid;
        }
    }
}

